package com.tangding.common.holder;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

/**
 * @description 配置持有
 *
 * @author Ranger
 * @version 2017年7月5日_上午11:31:14
 *
 */
public class PropertyHolder extends PropertyPlaceholderConfigurer {
	
	private static Map<Object, Object> datas = new HashMap<Object, Object>();
	
	@Override
	protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props) throws BeansException {
		super.processProperties(beanFactoryToProcess, props);
		
		Set<Object> keys = props.keySet();
		for (Object key : keys) {
			datas.put(key, props.get(key));
		}
	}
	
	public static Object getValue(Object key) {
		return datas.get(key);
	}
}
